-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: content edit #664
base: main
Are you sure you want to change the base?
fix: content edit #664
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The content type "add" form, needs to includes the dynamic fields so that the user doesn't have to edit again to configure those.
API side, we need to add a default value.
Thank you for the review 🙏 |
{...register("name", { | ||
required: t("message.name_is_required"), | ||
})} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @IkbelTalebHssan, i have noticed that the input helperText attribute is accidentally removed
{...register("name", { | |
required: t("message.name_is_required"), | |
})} | |
{...register("name", { | |
required: t("message.name_is_required"), | |
})} | |
helperText={errors.name ? errors.name.message : null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accidentally removed
Thank you @yassinedorbozgithub for the review 🙏
Fixed ✔️
useEffect(() => { | ||
if (open) reset(); | ||
}, [open, reset]); | ||
|
||
useEffect(() => { | ||
if (data) { | ||
reset({ | ||
name: data.name, | ||
}); | ||
} else { | ||
reset(); | ||
} | ||
}, [data, reset]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a general rule, useEffect() should be place at the end, before the "return"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a general rule, useEffect() should be place at the end, before the "return"
Updated to be at the end ✔️
} else { | ||
createContentType(params); | ||
createContentType({ ...params, name: params.name || "" }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createContentType({ ...params, name: params.name || "" }); | |
createContentType({ ...params, name: params.name || "" }); |
The content type "name" attribute should not be empty. In which case are getting it empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct fixed that ✔️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use the same dialog component for the add and edit.
Motivation
We need to ensure that content["dynamicFields"] is defined before trying to access its properties.
Fixes (issue)
Type of change:
Please delete options that are not relevant.
Checklist: